package com.ys.homework;

/**
 * 描述: 基础 圆类
 *
 * @author CodeYang
 * @version 2020/12/15 20:46
 */
public class Circle {
    /**
     * 半径
     */
    private  double radius;

    public Circle() {
    }

    public Circle(double radius) {
        this.radius = radius;
    }

    public double getRadius() {
        return radius;
    }

    public void setRadius(double radius) {
        this.radius = radius;
    }

    /**
     * 获取圆的面积
     * @return  面积
     */
    public double getArea(){
        return Math.PI*Math.pow(radius,2);
    }

    /**
     * 获取圆的周长
     * @return
     */
    public double getPerimeter(){
        return 2*Math.PI*radius;
    }

    /**
     * 打印圆的信息
     */
    public void show(){
        System.out.println("radius = " + this.radius);
        System.out.println("Area = " + this.getArea());
        System.out.println("Perimeter = " + this.getPerimeter());
    }
}
